﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.JumpAssignedObject.CApJumpAssignedObjectEnabler
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System.Collections.ObjectModel;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.PrivateImplementationDetails;


namespace DnProcessSimulateCommands.JumpAssignedObject;

public class CApJumpAssignedObjectEnabler : ITxCommandEnabler
{
  private bool ShouldEnable()
  {
    bool flag = false;
    if ((TxTcUtilities.IsTcOnlinePlatform || TxApplication.ActiveDocument.CurrentStudy != null) && TxApplication.ActiveSelection.Count == 1)
    {
      ITxObject allItem = ((Collection<ITxObject>) TxApplication.ActiveSelection.GetAllItems())[0];
      ITxLocatableObject itxLocatableObject = (ITxLocatableObject) null;
      if (allItem is TxObjectFlowOperation)
        itxLocatableObject = CApJumpAssignedObjectApp.GetFlowOperationSimulatedObject(allItem as TxObjectFlowOperation);
      else if (allItem is TxObjectFlowLocationOperation)
        itxLocatableObject = CApJumpAssignedObjectApp.GetFlowOperationSimulatedObject(allItem as TxObjectFlowLocationOperation);
      if (itxLocatableObject != null)
        flag = true;
    }
    return flag;
  }

  public bool Enable => this.ShouldEnable();
}
